home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / program / 320 / compsrc2 / optabs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-10-20  |  53.9 KB  |  1,851 lines

  1. /* Expand the basic unary and binary arithmetic operations, for GNU compiler.
  2.    Copyright (C) 1987 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU CC.
  5.  
  6. GNU CC is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY.  No author or distributor
  8. accepts responsibility to anyone for the consequences of using it
  9. or for whether it serves any particular purpose or works at all,
  10. unless he says so in writing.  Refer to the GNU CC General Public
  11. License for full details.
  12.  
  13. Everyone is granted permission to copy, modify and redistribute
  14. GNU CC, but only under the conditions described in the
  15. GNU CC General Public License.   A copy of this license is
  16. supposed to have been given to you along with GNU CC so you
  17. can know your rights and responsibilities.  It should be in a
  18. file named COPYING.  Among other things, the copyright notice
  19. and this notice must be preserved on all copies.  */
  20.  
  21.  
  22. #include "config.h"
  23. #include "rtl.h"
  24. #include "tree.h"
  25. #include "flags.h"
  26. #include "insn-flags.h"
  27. #include "insn-codes.h"
  28. #include "expr.h"
  29. #include "insn-config.h"
  30. #include "recog.h"
  31.  
  32. /* Each optab contains info on how this target machine
  33.    can perform a particular operation
  34.    for all sizes and kinds of operands.
  35.  
  36.    The operation to be performed is often specified
  37.    by passing one of these optabs as an argument.
  38.  
  39.    See expr.h for documentation of these optabs.  */
  40.  
  41. optab add_optab;
  42. optab sub_optab;
  43. optab smul_optab;
  44. optab umul_optab;
  45. optab smul_widen_optab;
  46. optab umul_widen_optab;
  47. optab sdiv_optab;
  48. optab sdivmod_optab;
  49. optab udiv_optab;
  50. optab udivmod_optab;
  51. optab smod_optab;
  52. optab umod_optab;
  53. optab flodiv_optab;
  54. optab ftrunc_optab;
  55. optab and_optab;
  56. optab andcb_optab;
  57. optab ior_optab;
  58. optab xor_optab;
  59. optab ashl_optab;
  60. optab lshr_optab;
  61. optab lshl_optab;
  62. optab ashr_optab;
  63. optab rotl_optab;
  64. optab rotr_optab;
  65.  
  66. optab mov_optab;
  67. optab movstrict_optab;
  68.  
  69. optab neg_optab;
  70. optab abs_optab;
  71. optab one_cmpl_optab;
  72. optab ffs_optab;
  73.  
  74. optab cmp_optab;
  75. optab tst_optab;
  76.  
  77. /* Generate code to perform an operation specified by BINOPTAB
  78.    on operands OP0 and OP1, with result having machine-mode MODE.
  79.  
  80.    UNSIGNEDP is for the case where we have to widen the operands
  81.    to perform the operation.  It says to use zero-extension.
  82.  
  83.    If TARGET is nonzero, the value
  84.    is generated there, if it is convenient to do so.
  85.    In all cases an rtx is returned for the locus of the value;
  86.    this may or may not be TARGET.  */
  87.  
  88. rtx
  89. expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
  90.      enum machine_mode mode;
  91.      optab binoptab;
  92.      rtx op0, op1;
  93.      rtx target;
  94.      int unsignedp;
  95.      enum optab_methods methods;
  96. {
  97.   register rtx temp;
  98.   rtx last = get_last_insn ();
  99.  
  100.   op0 = protect_from_queue (op0, 0);
  101.   op1 = protect_from_queue (op1, 0);
  102.   if (target)
  103.     target = protect_from_queue (target, 1);
  104.  
  105. #if 0
  106.   /* We may get better code by generating the result in a register
  107.      when the target is not one of the operands.  */
  108.   if (target && ! rtx_equal_p (target, op1) && ! rtx_equal_p (target, op0))
  109.     target_is_not_an_operand = 1;
  110. #endif
  111.  
  112.   if (flag_force_mem)
  113.     {
  114.       op0 = force_not_mem (op0);
  115.       op1 = force_not_mem (op1);
  116.     }
  117.  
  118.   /* If operation is commutative,
  119.      try to make the first operand a register.
  120.      Even better, try to make it the same as the target.
  121.      Also try to make the last operand a constant.  */
  122.   if (binoptab == add_optab
  123.       || binoptab == and_optab
  124.       || binoptab == ior_optab
  125.       || binoptab == xor_optab
  126.       || binoptab == smul_optab
  127.       || binoptab == umul_optab
  128.       || binoptab == smul_widen_optab
  129.       || binoptab == umul_widen_optab)
  130.     {
  131.       if (((target == 0 || GET_CODE (target) == REG)
  132.        ? ((GET_CODE (op1) == REG
  133.            && GET_CODE (op0) != REG)
  134.           || target == op1)
  135.        : rtx_equal_p (op1, target))
  136.       ||
  137.       GET_CODE (op0) == CONST_INT)
  138.     {
  139.       temp = op1;
  140.       op1 = op0;
  141.       op0 = temp;
  142.     }
  143.     }
  144.  
  145.   /* If we can do it with a three-operand insn, do so.  */
  146.  
  147.   if (binoptab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
  148.     {
  149.       int icode = (int) binoptab->handlers[(int) mode].insn_code;
  150.       enum machine_mode mode0 = insn_operand_mode[icode][1];
  151.       enum machine_mode mode1 = insn_operand_mode[icode][2];
  152.       rtx pat;
  153.       rtx xop0 = op0, xop1 = op1;
  154.  
  155.       if (target)
  156.     temp = target;
  157.       else
  158.     temp = gen_reg_rtx (mode);
  159.  
  160.       /* In case the insn wants input operands in modes different from
  161.      the result, convert the operands.  */
  162.  
  163.       if (GET_MODE (op0) != VOIDmode
  164.       && GET_MODE (op0) != mode0)
  165.     xop0 = convert_to_mode (mode0, xop0, unsignedp);
  166.  
  167.       if (GET_MODE (xop1) != VOIDmode
  168.       && GET_MODE (xop1) != mode1)
  169.     xop1 = convert_to_mode (mode1, xop1, unsignedp);
  170.  
  171.       /* Now, if insn requires register operands, put operands into regs.  */
  172.  
  173.       if (! (*insn_operand_predicate[icode][1]) (xop0, mode0))
  174.     xop0 = force_reg (mode0, xop0);
  175.  
  176.       if (! (*insn_operand_predicate[icode][2]) (xop1, mode1))
  177.     xop1 = force_reg (mode1, xop1);
  178.  
  179.       if (! (*insn_operand_predicate[icode][0]) (temp, mode))
  180.     temp = gen_reg_rtx (mode);
  181.  
  182.       pat = GEN_FCN (icode) (temp, xop0, xop1);
  183.       if (pat)
  184.     {
  185.       emit_insn (pat);
  186.       return temp;
  187.     }
  188.       else
  189.     delete_insns_since (last);
  190.     }
  191.  
  192.   /* It can't be open-coded in this mode.
  193.      Use a library call if one is available and caller says that's ok.  */
  194.  
  195.   if (binoptab->handlers[(int) mode].lib_call
  196.       && (methods == OPTAB_LIB || methods == OPTAB_LIB_WIDEN))
  197.     {
  198.       rtx insn_before;
  199.       rtx funexp = gen_rtx (SYMBOL_REF, Pmode,
  200.                 binoptab->handlers[(int) mode].lib_call);
  201.  
  202.       /* Pass the address through a pseudoreg, if desired,
  203.      before the "beginning" of the library call (for deletion).  */
  204. #ifndef NO_FUNCTION_CSE
  205.       if (! flag_no_function_cse)
  206.     funexp = copy_to_mode_reg (Pmode, funexp);
  207. #endif
  208.       insn_before = get_last_insn ();
  209.  
  210.       /* Cannot pass FUNEXP since emit_library_call insists
  211.      on getting a SYMBOL_REF.  But cse will make this SYMBOL_REF
  212.      be replaced with the copy we made just above.  */
  213.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode,
  214.                   binoptab->handlers[(int) mode].lib_call),
  215.              mode, 2, op0, mode, op1, mode);
  216.       target = hard_libcall_value (mode);
  217.       temp = copy_to_reg (target);
  218.       REG_NOTES (get_last_insn ())
  219.     = gen_rtx (EXPR_LIST, REG_EQUAL,
  220.            gen_rtx (binoptab->code, mode, op0, op1),
  221.            gen_rtx (INSN_LIST, REG_RETVAL,
  222.                 NEXT_INSN (insn_before), 0));
  223.       return temp;
  224.     }
  225.  
  226.   /* It can't be done in this mode.  Can we do it in a wider mode?  */
  227.  
  228.   if (! (methods == OPTAB_WIDEN || methods == OPTAB_LIB_WIDEN))
  229.     return 0;            /* Caller says, don't even try.  */
  230.  
  231.   /* Compute the value of METHODS to pass to recursive calls.
  232.      Don't allow widening to be tried recursively.  */
  233.  
  234.   methods = (methods == OPTAB_LIB_WIDEN ? OPTAB_LIB : OPTAB_DIRECT);
  235.  
  236.   if ((mode == HImode || mode == QImode)
  237.       && (binoptab->handlers[(int) SImode].insn_code != CODE_FOR_nothing
  238.       || (methods == OPTAB_LIB
  239.           && binoptab->handlers[(int) SImode].lib_call)))
  240.     {
  241.       rtx xop0 = op0, xop1 = op1;
  242.  
  243.       if (GET_MODE (xop0) != VOIDmode)
  244.     {
  245.       temp = gen_reg_rtx (SImode);
  246.       convert_move (temp, xop0, unsignedp);
  247.       xop0 = temp;
  248.     }
  249.       if (GET_MODE (xop1) != VOIDmode)
  250.     {
  251.       temp = gen_reg_rtx (SImode);
  252.       convert_move (temp, xop1, unsignedp);
  253.       xop1 = temp;
  254.     }
  255.  
  256.       temp = expand_binop (SImode, binoptab, xop0, xop1, 0,
  257.                unsignedp, methods);
  258.       if (temp)
  259.     return gen_lowpart (mode, temp);
  260.       else
  261.     delete_insns_since (last);
  262.     }
  263.   if ((mode == HImode || mode == QImode || mode == SImode)
  264.       && (binoptab->handlers[(int) DImode].insn_code != CODE_FOR_nothing
  265.       || (methods == OPTAB_LIB
  266.           && binoptab->handlers[(int) DImode].lib_call)))
  267.     {
  268.       rtx xop0 = op0, xop1 = op1;
  269.  
  270.       temp = gen_reg_rtx (DImode);
  271.       convert_move (temp, xop0, unsignedp);
  272.       xop0 = temp;
  273.       temp = gen_reg_rtx (DImode);
  274.       convert_move (temp, xop1, unsignedp);
  275.       xop1 = temp;
  276.  
  277.       temp = expand_binop (DImode, binoptab, xop0, xop1, 0,
  278.                unsignedp, methods);
  279.       if (temp)
  280.     return gen_lowpart (mode, temp);
  281.       else
  282.     delete_insns_since (last);
  283.     }
  284.   if (mode == SFmode
  285.       && (binoptab->handlers[(int) DFmode].insn_code != CODE_FOR_nothing
  286.       || (methods == OPTAB_LIB
  287.           && binoptab->handlers[(int) DFmode].lib_call)))
  288.     {
  289.       rtx xop0 = op0, xop1 = op1;
  290.  
  291.       temp = gen_reg_rtx (DFmode);
  292.       convert_move (temp, xop0, 0);
  293.       xop0 = temp;
  294.       temp = gen_reg_rtx (DFmode);
  295.       convert_move (temp, xop1, 0);
  296.       xop1 = temp;
  297.  
  298.       temp = expand_binop (DFmode, binoptab, xop0, xop1, 0, 0, methods);
  299.       if (temp)
  300.     {
  301.       if (target == 0)
  302.         target = gen_reg_rtx (SFmode);
  303.       convert_move (target, temp, 0);
  304.       return target;
  305.     }
  306.       else
  307.     delete_insns_since (last);
  308.     }
  309.   return 0;
  310. }
  311.  
  312. /* Generate code to perform an operation specified by BINOPTAB
  313.    on operands OP0 and OP1, with two results to TARG1 and TARG2.
  314.    We assume that the order of the operands for the instruction
  315.    is TARG0, OP0, OP1, TARG1, which would fit a pattern like
  316.    [(set TARG0 (operate OP0 OP1)) (set TARG1 (operate ...))].
  317.  
  318.    Either TARG0 or TARG1 may be zero, but what that means is that
  319.    that result is not actually wanted.  We will generate it into
  320.    a dummy pseudo-reg and discard it.  They may not both be zero.
  321.  
  322.    Returns 1 if this operation can be performed; 0 if not.  */
  323.  
  324. int
  325. expand_twoval_binop (binoptab, op0, op1, targ0, targ1, unsignedp)
  326.      optab binoptab;
  327.      rtx op0, op1;
  328.      rtx targ0, targ1;
  329.      int unsignedp;
  330. {
  331.   enum machine_mode mode = GET_MODE (targ0 ? targ0 : targ1);
  332.  
  333.   op0 = protect_from_queue (op0, 0);
  334.   op1 = protect_from_queue (op1, 0);
  335.  
  336.   if (flag_force_mem)
  337.     {
  338.       op0 = force_not_mem (op0);
  339.       op1 = force_not_mem (op1);
  340.     }
  341.  
  342.   if (targ0)
  343.     targ0 = protect_from_queue (targ0, 1);
  344.   else
  345.     targ0 = gen_reg_rtx (mode);
  346.   if (targ1)
  347.     targ1 = protect_from_queue (targ1, 1);
  348.   else
  349.     targ1 = gen_reg_rtx (mode);
  350.  
  351.   if (binoptab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
  352.     {
  353.       emit_insn (GEN_FCN (binoptab->handlers[(int) mode].insn_code)
  354.          (targ0, op0, op1, targ1));
  355.       return 1;
  356.     }
  357.  
  358.   /* It can't be done in this mode.  Can we do it in a wider mode?  */
  359.  
  360.   if ((mode == HImode || mode == QImode)
  361.       && binoptab->handlers[(int) SImode].insn_code != CODE_FOR_nothing)
  362.     {
  363.       expand_twoval_binop_convert (binoptab, SImode, op0, op1,
  364.                    targ0, targ1, unsignedp);
  365.       return 1;
  366.     }
  367.   if ((mode == HImode || mode == QImode || mode == SImode)
  368.       && binoptab->handlers[(int) DImode].insn_code != CODE_FOR_nothing)
  369.     {
  370.       expand_twoval_binop_convert (binoptab, DImode, op0, op1,
  371.                    targ0, targ1, unsignedp);
  372.       return 1;
  373.     }
  374.   if (mode == SFmode
  375.       && binoptab->handlers[(int) DFmode].insn_code != CODE_FOR_nothing)
  376.     {
  377.       expand_twoval_binop_convert (binoptab, DFmode, op0, op1,
  378.                    targ0, targ1, unsignedp);
  379.       return 1;
  380.     }
  381.   return 0;
  382. }
  383.  
  384. int
  385. expand_twoval_binop_convert (binoptab, mode, op0, op1, targ0, targ1, unsignedp)
  386.      register optab binoptab;
  387.      register rtx op0, op1, targ0, targ1;
  388.      int unsignedp;
  389. {
  390.   register rtx t0 = gen_reg_rtx (SImode);
  391.   register rtx t1 = gen_reg_rtx (SImode);
  392.   register rtx temp;
  393.  
  394.   temp = gen_reg_rtx (SImode);
  395.   convert_move (temp, op0, unsignedp);
  396.   op0 = temp;
  397.   temp = gen_reg_rtx (SImode);
  398.   convert_move (temp, op1, unsignedp);
  399.   op1 = temp;
  400.  
  401.   expand_twoval_binop (binoptab, op0, op1, t0, t1, unsignedp);
  402.   convert_move (targ0, t0, unsignedp);
  403.   convert_move (targ1, t1, unsignedp);
  404.   return 1;
  405. }
  406.  
  407. /* Generate code to perform an operation specified by UNOPTAB
  408.    on operand OP0, with result having machine-mode MODE.
  409.  
  410.    UNSIGNEDP is for the case where we have to widen the operands
  411.    to perform the operation.  It says to use zero-extension.
  412.  
  413.    If TARGET is nonzero, the value
  414.    is generated there, if it is convenient to do so.
  415.    In all cases an rtx is returned for the locus of the value;
  416.    this may or may not be TARGET.  */
  417.  
  418. rtx
  419. expand_unop (mode, unoptab, op0, target, unsignedp)
  420.      enum machine_mode mode;
  421.      optab unoptab;
  422.      rtx op0;
  423.      rtx target;
  424.      int unsignedp;
  425. {
  426.   register rtx temp;
  427.  
  428.   op0 = protect_from_queue (op0, 0);
  429.  
  430.   if (flag_force_mem)
  431.     {
  432.       op0 = force_not_mem (op0);
  433.     }
  434.  
  435.   if (target)
  436.     target = protect_from_queue (target, 1);
  437.  
  438.   if (unoptab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
  439.     {
  440.       int icode = (int) unoptab->handlers[(int) mode].insn_code;
  441.       enum machine_mode mode0 = insn_operand_mode[icode][1];
  442.  
  443.       if (target)
  444.     temp = target;
  445.       else
  446.     temp = gen_reg_rtx (mode);
  447.  
  448.       if (GET_MODE (op0) != VOIDmode
  449.       && GET_MODE (op0) != mode0)
  450.     op0 = convert_to_mode (mode0, op0, unsignedp);
  451.  
  452.       /* Now, if insn requires register operands, put operands into regs.  */
  453.  
  454.       if (! (*insn_operand_predicate[icode][1]) (op0, mode0))
  455.     op0 = force_reg (mode0, op0);
  456.  
  457.       if (! (*insn_operand_predicate[icode][0]) (temp, mode))
  458.     temp = gen_reg_rtx (mode);
  459.  
  460.       emit_insn (GEN_FCN (icode) (temp, op0));
  461.       return temp;
  462.     }
  463.   else if (unoptab->handlers[(int) mode].lib_call)
  464.     {
  465.       rtx insn_before;
  466.       rtx funexp = gen_rtx (SYMBOL_REF, Pmode,
  467.                 unoptab->handlers[(int) mode].lib_call);
  468.  
  469.       /* Pass the address through a pseudoreg, if desired,
  470.      before the "beginning" of the library call (for deletion).  */
  471. #ifndef NO_FUNCTION_CSE
  472.       if (! flag_no_function_cse)
  473.     funexp = copy_to_mode_reg (Pmode, funexp);
  474. #endif
  475.       insn_before = get_last_insn ();
  476.  
  477.       /* Cannot pass FUNEXP since  emit_library_call insists
  478.      on getting a SYMBOL_REF.  But cse will make this SYMBOL_REF
  479.      be replaced with the copy we made just above.  */
  480.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode,
  481.                   unoptab->handlers[(int) mode].lib_call),
  482.              mode, 1, op0, mode);
  483.       target = hard_libcall_value (mode);
  484.       temp = copy_to_reg (target);
  485.       REG_NOTES (get_last_insn ())
  486.     = gen_rtx (EXPR_LIST, REG_EQUAL,
  487.            gen_rtx (unoptab->code, mode, op0),
  488.            gen_rtx (INSN_LIST, REG_RETVAL,
  489.                 NEXT_INSN (insn_before), 0));
  490.       return temp;
  491.     }
  492.  
  493.   /* It can't be done in this mode.  Can we do it in a wider mode?  */
  494.  
  495.   if ((mode == HImode || mode == QImode)
  496.       && (unoptab->handlers[(int) SImode].insn_code != CODE_FOR_nothing
  497.       || unoptab->handlers[(int) SImode].lib_call))
  498.     {
  499.       if (GET_MODE (op0) != VOIDmode)
  500.     {
  501.       temp = gen_reg_rtx (SImode);
  502.       convert_move (temp, op0, unsignedp);
  503.       op0 = temp;
  504.     }
  505.  
  506.       target = expand_unop (SImode, unoptab, op0, 0, unsignedp);
  507.       return gen_lowpart (mode, target);
  508.     }
  509.   if ((mode == HImode || mode == QImode || mode == SImode)
  510.       && (unoptab->handlers[(int) DImode].insn_code != CODE_FOR_nothing
  511.       || unoptab->handlers[(int) DImode].lib_call))
  512.     {
  513.       temp = gen_reg_rtx (DImode);
  514.       convert_move (temp, op0, unsignedp);
  515.       op0 = temp;
  516.  
  517.       target = expand_unop (DImode, unoptab, op0, 0, unsignedp);
  518.       return gen_lowpart (mode, target);
  519.     }
  520.   if (mode == SFmode
  521.       && (unoptab->handlers[(int) DFmode].insn_code != CODE_FOR_nothing
  522.       || unoptab->handlers[(int) DFmode].lib_call))
  523.     {
  524.       temp = gen_reg_rtx (DFmode);
  525.       convert_move (temp, op0, 0);
  526.       op0 = temp;
  527.  
  528.       temp = expand_unop (DFmode, unoptab, op0, 0, 0);
  529.       if (target == 0)
  530.     target = gen_reg_rtx (SFmode);
  531.       convert_move (target, temp, 0);
  532.       return target;
  533.     }
  534.  
  535.   return 0;
  536. }
  537.  
  538. /* Generate an instruction whose insn-code is INSN_CODE,
  539.    with two operands: an output TARGET and an input OP0.
  540.    TARGET *must* be nonzero, and the output is always stored there.
  541.    CODE is an rtx code such that (CODE OP0) is an rtx that describes
  542.    the value that is stored into TARGET.  */
  543.  
  544. void
  545. emit_unop_insn (icode, target, op0, code)
  546.      int icode;
  547.      rtx target;
  548.      rtx op0;
  549.      enum rtx_code code;
  550. {
  551.   register rtx temp;
  552.   enum machine_mode mode0 = insn_operand_mode[icode][1];
  553.   rtx insn;
  554.   rtx prev_insn = get_last_insn ();
  555.  
  556.   temp = target = protect_from_queue (target, 1);
  557.  
  558.   op0 = protect_from_queue (op0, 0);
  559.  
  560.   if (flag_force_mem)
  561.     op0 = force_not_mem (op0);
  562.  
  563.   /* Now, if insn requires register operands, put operands into regs.  */
  564.  
  565.   if (! (*insn_operand_predicate[icode][1]) (op0, mode0))
  566.     op0 = force_reg (mode0, op0);
  567.  
  568.   if (! (*insn_operand_predicate[icode][0]) (temp, GET_MODE (temp))
  569.       || (flag_force_mem && GET_CODE (temp) == MEM))
  570.     temp = gen_reg_rtx (GET_MODE (temp));
  571.  
  572.   insn = emit_insn (GEN_FCN (icode) (temp, op0));
  573.  
  574.   /* If we just made a multi-insn sequence,
  575.      record in the last insn an equivalent expression for its value
  576.      and a pointer to the first insn.  This makes cse possible.  */
  577.   if (code != UNKNOWN && insn != NEXT_INSN (prev_insn))
  578.     REG_NOTES (insn)
  579.       = gen_rtx (EXPR_LIST, REG_EQUAL,
  580.          gen_rtx (code, GET_MODE (temp), op0),
  581.          0);
  582.   
  583.   if (temp != target)
  584.     emit_move_insn (target, temp);
  585. }
  586.  
  587. /* Generate code to store zero in X.  */
  588.  
  589. void
  590. emit_clr_insn (x)
  591.      rtx x;
  592. {
  593.   emit_move_insn (x, const0_rtx);
  594. }
  595.  
  596. /* Generate code to store 1 in X
  597.    assuming it contains zero beforehand.  */
  598.  
  599. void
  600. emit_0_to_1_insn (x)
  601.      rtx x;
  602. {
  603.   emit_move_insn (x, const1_rtx);
  604. }
  605.  
  606. /* Generate code to compare X with Y
  607.    so that the condition codes are set.
  608.    If they have mode BLKmode, then SIZE specifies the size of block.  */
  609.  
  610. void
  611. emit_cmp_insn (x, y, size, unsignedp)
  612.      rtx x, y;
  613.      rtx size;
  614.      int unsignedp;
  615. {
  616.   enum machine_mode mode = GET_MODE (x);
  617.   if (mode == VOIDmode) mode = GET_MODE (y);
  618.   /* They could both be VOIDmode if both args are immediate constants,
  619.      but we should fold that at an earlier stage.
  620.      With no special code here, this will call abort,
  621.      reminding the programmer to implement such folding.  */
  622.  
  623.   emit_queue ();
  624.   x = protect_from_queue (x, 0);
  625.   y = protect_from_queue (y, 0);
  626.  
  627.   if (mode != BLKmode && flag_force_mem)
  628.     {
  629.       x = force_not_mem (x);
  630.       y = force_not_mem (y);
  631.     }
  632.  
  633.   if (mode == BLKmode)
  634.     {
  635.       if (size == 0)
  636.     abort ();
  637. #ifdef HAVE_cmpstrqi
  638.       if (HAVE_cmpstrqi
  639.       && GET_CODE (size) == CONST_INT
  640.       && INTVAL (size) < (1 << BITS_PER_UNIT))
  641.     emit_insn (gen_cmpstrqi (x, y, convert_to_mode (SImode, size, 1)));
  642.       else
  643. #endif
  644. #ifdef HAVE_cmpstrsi
  645.       if (HAVE_cmpstrsi)
  646.     emit_insn (gen_cmpstrsi (x, y, convert_to_mode (SImode, size, 1)));
  647.       else
  648. #endif
  649.     {
  650. #ifdef TARGET_MEM_FUNCTIONS
  651.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "memcmp"),
  652.                  SImode, 3, x, Pmode, y, Pmode, size, Pmode);
  653. #else
  654.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "bcmp"),
  655.                  SImode, 3, x, Pmode, y, Pmode, size, Pmode);
  656. #endif
  657.       emit_cmp_insn (hard_libcall_value (SImode), const0_rtx, 0, 0);
  658.     }
  659.     }
  660.   else if ((y == const0_rtx || y == fconst0_rtx || y == dconst0_rtx)
  661.        && tst_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
  662.     {
  663.       int icode = (int) tst_optab->handlers[(int) mode].insn_code;
  664.  
  665.       /* Now, if insn requires register operands, put operands into regs.  */
  666.       if (! (*insn_operand_predicate[icode][0])
  667.       (x, insn_operand_mode[icode][0]))
  668.     x = force_reg (insn_operand_mode[icode][0], x);
  669.  
  670.       emit_insn (GEN_FCN (icode) (x));
  671.     }
  672.   else if (cmp_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
  673.     {
  674.       int icode = (int) cmp_optab->handlers[(int) mode].insn_code;
  675.  
  676.       /* Now, if insn requires register operands, put operands into regs.  */
  677.       if (! (*insn_operand_predicate[icode][0])
  678.       (x, insn_operand_mode[icode][0]))
  679.     x = force_reg (insn_operand_mode[icode][0], x);
  680.  
  681.       if (! (*insn_operand_predicate[icode][1])
  682.       (y, insn_operand_mode[icode][1]))
  683.     y = force_reg (insn_operand_mode[icode][1], y);
  684.  
  685.       emit_insn (GEN_FCN (icode) (x, y));
  686.     }
  687.   else if ((mode == QImode || mode == HImode)
  688.        && cmp_optab->handlers[(int) SImode].insn_code != CODE_FOR_nothing)
  689.     {
  690.       x = convert_to_mode (SImode, x, unsignedp);
  691.       y = convert_to_mode (SImode, y, unsignedp);
  692.       emit_cmp_insn (x, y, 0, unsignedp);
  693.     }
  694.   else if ((mode == QImode || mode == HImode || mode == SImode)
  695.        && cmp_optab->handlers[(int) DImode].insn_code != CODE_FOR_nothing)
  696.     {
  697.       x = convert_to_mode (DImode, x, unsignedp);
  698.       y = convert_to_mode (DImode, y, unsignedp);
  699.       emit_cmp_insn (x, y, 0, unsignedp);
  700.     }
  701.   else if (mode == SFmode
  702.        && cmp_optab->handlers[(int) DFmode].insn_code != CODE_FOR_nothing)
  703.     {
  704.       x = convert_to_mode (DFmode, x, unsignedp);
  705.       y = convert_to_mode (DFmode, y, unsignedp);
  706.       emit_cmp_insn (x, y, 0, unsignedp);
  707.     }
  708.   else if (cmp_optab->handlers[(int) mode].lib_call)
  709.     {
  710.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode,
  711.                   cmp_optab->handlers[(int) mode].lib_call),
  712.              SImode, 2, x, mode, y, mode);
  713.       emit_cmp_insn (hard_libcall_value (SImode), const0_rtx, 0, 0);
  714.     }
  715.   else if ((mode == QImode || mode == HImode)
  716.        && (cmp_optab->handlers[(int) SImode].insn_code != CODE_FOR_nothing
  717.            || cmp_optab->handlers[(int) SImode].lib_call != 0))
  718.     {
  719.       x = convert_to_mode (SImode, x, unsignedp);
  720.       y = convert_to_mode (SImode, y, unsignedp);
  721.       emit_cmp_insn (x, y, 0, unsignedp);
  722.     }
  723.   else if ((mode == QImode || mode == HImode || mode == SImode)
  724.        && (cmp_optab->handlers[(int) DImode].insn_code != CODE_FOR_nothing
  725.            || cmp_optab->handlers[(int) DImode].lib_call != 0))
  726.     {
  727.       x = convert_to_mode (DImode, x, unsignedp);
  728.       y = convert_to_mode (DImode, y, unsignedp);
  729.       emit_cmp_insn (x, y, 0, unsignedp);
  730.     }
  731.   else if (mode == SFmode
  732.        && (cmp_optab->handlers[(int) DFmode].insn_code != CODE_FOR_nothing
  733.            || cmp_optab->handlers[(int) DFmode].lib_call != 0))
  734.     {
  735.       x = convert_to_mode (DFmode, x, unsignedp);
  736.       y = convert_to_mode (DFmode, y, unsignedp);
  737.       emit_cmp_insn (x, y, 0, unsignedp);
  738.     }
  739.   else
  740.     abort ();
  741. }
  742.  
  743. /* These three functions generate an insn body and return it
  744.    rather than emitting the insn.
  745.  
  746.    They do not protect from queued increments,
  747.    because they may be used 1) in protect_from_queue itself
  748.    and 2) in other passes where there is no queue.  */
  749.  
  750. /* Generate and return an insn body to add Y to X.  */
  751.  
  752. rtx
  753. gen_add2_insn (x, y)
  754.      rtx x, y;
  755. {
  756.   return (GEN_FCN (add_optab->handlers[(int) GET_MODE (x)].insn_code)
  757.       (x, x, y));
  758. }
  759.  
  760. int
  761. have_add2_insn (mode)
  762.      enum machine_mode mode;
  763. {
  764.   return add_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing;
  765. }
  766.  
  767. /* Generate and return an insn body to subtract Y from X.  */
  768.  
  769. rtx
  770. gen_sub2_insn (x, y)
  771.      rtx x, y;
  772. {
  773.   return (GEN_FCN (sub_optab->handlers[(int) GET_MODE (x)].insn_code)
  774.       (x, x, y));
  775. }
  776.  
  777. int
  778. have_sub2_insn (mode)
  779.      enum machine_mode mode;
  780. {
  781.   return add_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing;
  782. }
  783.  
  784. /* Generate the body of an instruction to copy Y into X.  */
  785.  
  786. rtx
  787. gen_move_insn (x, y)
  788.      rtx x, y;
  789. {
  790.   register enum machine_mode mode = GET_MODE (x);
  791.   if (mode == VOIDmode)
  792.     mode = GET_MODE (y);
  793.   return (GEN_FCN (mov_optab->handlers[(int) mode].insn_code) (x, y));
  794. }
  795.  
  796. /* Tables of patterns for extending one integer mode to another.  */
  797. enum insn_code zero_extend_optab[MAX_MACHINE_MODE][MAX_MACHINE_MODE];
  798. enum insn_code sign_extend_optab[MAX_MACHINE_MODE][MAX_MACHINE_MODE];
  799.  
  800. /* Generate the body of an insn to extend Y (with mode MFROM)
  801.    into X (with mode MTO).  Do zero-extension if UNSIGNEDP is nonzero.  */
  802.  
  803. rtx
  804. gen_extend_insn (x, y, mto, mfrom, unsignedp)
  805.      rtx x, y;
  806.      enum machine_mode mto, mfrom;
  807.      int unsignedp;
  808. {
  809.   return (GEN_FCN ((unsignedp ? zero_extend_optab : sign_extend_optab)
  810.            [(int)mto][(int)mfrom])
  811.       (x, y));
  812. }
  813.  
  814. static void
  815. init_extends ()
  816. {
  817.   int i;
  818.   bzero (sign_extend_optab, sizeof sign_extend_optab);
  819.   bzero (zero_extend_optab, sizeof zero_extend_optab);
  820.   sign_extend_optab[(int) SImode][(int) HImode] = CODE_FOR_extendhisi2;
  821.   sign_extend_optab[(int) SImode][(int) QImode] = CODE_FOR_extendqisi2;
  822.   sign_extend_optab[(int) HImode][(int) QImode] = CODE_FOR_extendqihi2;
  823.   zero_extend_optab[(int) SImode][(int) HImode] = CODE_FOR_zero_extendhisi2;
  824.   zero_extend_optab[(int) SImode][(int) QImode] = CODE_FOR_zero_extendqisi2;
  825.   zero_extend_optab[(int) HImode][(int) QImode] = CODE_FOR_zero_extendqihi2;
  826. }
  827.  
  828. /* can_fix_p and can_float_p say whether the target machine
  829.    can directly convert a given fixed point type to
  830.    a given floating point type, or vice versa.  */
  831.  
  832. static rtxfun fixtab[2][2][2];
  833. static rtxfun fixtrunctab[2][2][2];
  834. static rtxfun floattab[2][2];
  835.  
  836. /* *TRUNCP_PTR is set to 1 if it is necessary to output
  837.    an explicit FTRUNC insn before the fix insn; otherwise 0.  */
  838.  
  839. rtxfun
  840. can_fix_p (fixmode, fltmode, unsignedp, truncp_ptr)
  841.      enum machine_mode fltmode, fixmode;
  842.      int unsignedp;
  843.      int *truncp_ptr;
  844. {
  845.   *truncp_ptr = 0;
  846.   if (fixtrunctab[fltmode != SFmode][fixmode == DImode][unsignedp])
  847.     return fixtrunctab[fltmode != SFmode][fixmode == DImode][unsignedp];
  848.   if (ftrunc_optab->handlers[(int) fltmode].insn_code != CODE_FOR_nothing)
  849.     {
  850.       *truncp_ptr = 1;
  851.       return fixtab[fltmode != SFmode][fixmode == DImode][unsignedp];
  852.     }
  853.   return 0;
  854. }
  855.  
  856. rtxfun
  857. can_float_p (fltmode, fixmode)
  858.      enum machine_mode fixmode, fltmode;
  859. {
  860.   return floattab[fltmode != SFmode][fixmode == DImode];
  861. }
  862.  
  863. void
  864. init_fixtab ()
  865. {
  866. #ifdef HAVE_fixsfsi2
  867.   if (HAVE_fixsfsi2)
  868.     fixtab[0][0][0] = gen_fixsfsi2;
  869. #endif
  870. #ifdef HAVE_fixsfdi2
  871.   if (HAVE_fixsfdi2)
  872.     fixtab[0][1][0] = gen_fixsfdi2;
  873. #endif
  874. #ifdef HAVE_fixdfsi2
  875.   if (HAVE_fixdfsi2)
  876.     fixtab[1][0][0] = gen_fixdfsi2;
  877. #endif
  878. #ifdef HAVE_fixdfdi2
  879.   if (HAVE_fixdfdi2)
  880.     fixtab[1][1][0] = gen_fixdfdi2;
  881. #endif
  882.  
  883. #ifdef HAVE_fixunssfsi2
  884.   if (HAVE_fixunssfsi2)
  885.     fixtab[0][0][1] = gen_fixunssfsi2;
  886. #endif
  887. #ifdef HAVE_fixunssfdi2
  888.   if (HAVE_fixunssfdi2)
  889.     fixtab[0][1][1] = gen_fixunssfdi2;
  890. #endif
  891. #ifdef HAVE_fixunsdfsi2
  892.   if (HAVE_fixunsdfsi2)
  893.     fixtab[1][0][1] = gen_fixunsdfsi2;
  894. #endif
  895. #ifdef HAVE_fixunsdfdi2
  896.   if (HAVE_fixunsdfdi2)
  897.     fixtab[1][1][1] = gen_fixunsdfdi2;
  898. #endif
  899.  
  900. #ifdef HAVE_fix_truncsfsi2
  901.   if (HAVE_fix_truncsfsi2)
  902.     fixtrunctab[0][0][0] = gen_fix_truncsfsi2;
  903. #endif
  904. #ifdef HAVE_fix_truncsfdi2
  905.   if (HAVE_fix_truncsfdi2)
  906.     fixtrunctab[0][1][0] = gen_fix_truncsfdi2;
  907. #endif
  908. #ifdef HAVE_fix_truncdfsi2
  909.   if (HAVE_fix_truncdfsi2)
  910.     fixtrunctab[1][0][0] = gen_fix_truncdfsi2;
  911. #endif
  912. #ifdef HAVE_fix_truncdfdi2
  913.   if (HAVE_fix_truncdfdi2)
  914.     fixtrunctab[1][1][0] = gen_fix_truncdfdi2;
  915. #endif
  916.  
  917. #ifdef HAVE_fixuns_truncsfsi2
  918.   if (HAVE_fixuns_truncsfsi2)
  919.     fixtrunctab[0][0][1] = gen_fixuns_truncsfsi2;
  920. #endif
  921. #ifdef HAVE_fixuns_truncsfdi2
  922.   if (HAVE_fixuns_truncsfdi2)
  923.     fixtrunctab[0][1][1] = gen_fixuns_truncsfdi2;
  924. #endif
  925. #ifdef HAVE_fixuns_truncdfsi2
  926.   if (HAVE_fixuns_truncdfsi2)
  927.     fixtrunctab[1][0][1] = gen_fixuns_truncdfsi2;
  928. #endif
  929. #ifdef HAVE_fixuns_truncdfdi2
  930.   if (HAVE_fixuns_truncdfdi2)
  931.     fixtrunctab[1][1][1] = gen_fixuns_truncdfdi2;
  932. #endif
  933.  
  934. #ifdef FIXUNS_TRUNC_LIKE_FIX_TRUNC
  935.   /* This flag says the same insns that convert to a signed fixnum
  936.      also convert validly to an unsigned one.  */
  937.   {
  938.     int i;
  939.     int j;
  940.     for (i = 0; i < 2; i++)
  941.       for (j = 0; j < 2; j++)
  942.     fixtrunctab[i][j][1] = fixtrunctab[i][j][0];
  943.   }
  944. #endif
  945. }
  946.  
  947. void
  948. init_floattab ()
  949. {
  950. #ifdef HAVE_floatsisf2
  951.   if (HAVE_floatsisf2)
  952.     floattab[0][0] = gen_floatsisf2;
  953. #endif
  954. #ifdef HAVE_floatdisf2
  955.   if (HAVE_floatdisf2)
  956.     floattab[0][1] = gen_floatdisf2;
  957. #endif
  958. #ifdef HAVE_floatsidf2
  959.   if (HAVE_floatsidf2)
  960.     floattab[1][0] = gen_floatsidf2;
  961. #endif
  962. #ifdef HAVE_floatdidf2
  963.   if (HAVE_floatdidf2)
  964.     floattab[1][1] = gen_floatdidf2;
  965. #endif
  966. }
  967.  
  968. /* Generate code to convert FROM to floating point
  969.    and store in TO.  FROM must be fixed point.
  970.    UNSIGNEDP nonzero means regard FROM as unsigned.
  971.    Normally this is done by correcting the final value
  972.    if it is negative.  */
  973.  
  974. void
  975. expand_float (real_to, from, unsignedp)
  976.      rtx real_to, from;
  977.      int unsignedp;
  978. {
  979.   register rtxfun fun;
  980.   register rtx intermediate = 0, to;
  981.  
  982.   to = real_to = protect_from_queue (real_to, 1);
  983.   from = protect_from_queue (from, 0);
  984.  
  985.   if (flag_force_mem)
  986.     {
  987.       from = force_not_mem (from);
  988.     }
  989.  
  990.   /* If we are about to do some arithmetic to correct for an
  991.      unsigned operand, do it in a register.  */
  992.  
  993.   if (unsignedp && GET_CODE (to) != REG)
  994.     to = gen_reg_rtx (GET_MODE (to));
  995.  
  996.   /* Now do the basic conversion.  Do it in the specified modes if possible;
  997.      otherwise convert either input, output or both with wider mode;
  998.      otherwise use a library call.  */
  999.  
  1000.   if (fun = can_float_p (GET_MODE (to), GET_MODE (from)))
  1001.     {
  1002.       emit_insn ((*fun) (to, from));
  1003.     }
  1004.   else if (GET_MODE (to) == SFmode
  1005.        && (fun = can_float_p (GET_MODE (from), DFmode)))
  1006.     {
  1007.       to = gen_reg_rtx (DFmode);
  1008.       emit_insn ((*fun) (to, from));
  1009.     }
  1010.   /* If we can't float a SI, maybe we can float a DI.
  1011.      If so, convert to DI and then float.  */
  1012.   else if (GET_MODE (from) != DImode
  1013.        && (can_float_p (GET_MODE (to), DImode)
  1014.            || can_float_p (DFmode, DImode)))
  1015.     {
  1016.       register rtx tem = gen_reg_rtx (DImode);
  1017.       convert_move (tem, from, unsignedp);
  1018.       from = tem;
  1019.       /* If we extend FROM then we don't need to correct
  1020.      the final value for unsignedness.  */
  1021.       unsignedp = 0;
  1022.  
  1023.       if (fun = can_float_p (GET_MODE (to), GET_MODE (from)))
  1024.     {
  1025.       emit_insn ((*fun) (to, from));
  1026.     }
  1027.       else if (fun = can_float_p (DFmode, DImode))
  1028.     {
  1029.       to = gen_reg_rtx (DFmode);
  1030.       emit_insn ((*fun) (to, from));
  1031.     }
  1032.     }
  1033.   /* No hardware instruction available; call a library
  1034.      to convert from SImode or DImode into DFmode.  */
  1035.   else
  1036.     {
  1037.       if (GET_MODE_SIZE (GET_MODE (from)) < GET_MODE_SIZE (SImode))
  1038.     {
  1039.       from = convert_to_mode (SImode, from, unsignedp);
  1040.       unsignedp = 0;
  1041.     }
  1042.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode,
  1043.                   (GET_MODE (from) == SImode ? "_floatsidf"
  1044.                    : "_floatdidf")),
  1045.              DFmode, 1, from, GET_MODE (from));
  1046.       to = copy_to_reg (hard_libcall_value (DFmode));
  1047.     }
  1048.  
  1049.   /* If FROM was unsigned but we treated it as signed,
  1050.      then in the case where it is negative (and therefore TO is negative),
  1051.      correct its value by 2**bitwidth.  */
  1052.  
  1053.   if (unsignedp)
  1054.     {
  1055.       rtx label = gen_label_rtx ();
  1056.       rtx temp;
  1057.       double offset;
  1058.       double ldexp ();
  1059.  
  1060.       do_pending_stack_adjust ();
  1061.       emit_cmp_insn (to, GET_MODE (to) == DFmode ? dconst0_rtx : fconst0_rtx,
  1062.              0, 0);
  1063.       emit_jump_insn (gen_bge (label));
  1064.       offset = ldexp (1.0, GET_MODE_BITSIZE (GET_MODE (from)));
  1065.       temp = expand_binop (GET_MODE (to), add_optab, to,
  1066.                immed_real_const_1 (offset, GET_MODE (to)),
  1067.                to, 0, OPTAB_LIB_WIDEN);
  1068.       if (temp != to)
  1069.     emit_move_insn (to, temp);
  1070.       do_pending_stack_adjust ();
  1071.       emit_label (label);
  1072.     }
  1073.  
  1074.   /* Copy result to requested destination
  1075.      if we have been computing in a temp location.  */
  1076.  
  1077.   if (to != real_to)
  1078.     {
  1079.       if (GET_MODE (real_to) == GET_MODE (to))
  1080.     emit_move_insn (real_to, to);
  1081.       else
  1082.     convert_move (real_to, to, 0);
  1083.     }
  1084. }
  1085.  
  1086. /* expand_fix: generate code to convert FROM to fixed point
  1087.    and store in TO.  FROM must be floating point.  */
  1088.  
  1089. static rtx
  1090. ftruncify (x)
  1091.      rtx x;
  1092. {
  1093.   rtx temp = gen_reg_rtx (GET_MODE (x));
  1094.   return expand_unop (GET_MODE (x), ftrunc_optab, x, temp, 0);
  1095. }
  1096.  
  1097. void
  1098. expand_fix (to, from, unsignedp)
  1099.      register rtx to, from;
  1100.      int unsignedp;
  1101. {
  1102.   register rtxfun fun;
  1103.   register rtx target;
  1104.   int must_trunc = 0;
  1105.  
  1106.   to = protect_from_queue (to, 1);
  1107.   from = protect_from_queue (from, 0);
  1108.  
  1109.   if (flag_force_mem)
  1110.     {
  1111.       from = force_not_mem (from);
  1112.     }
  1113.  
  1114.   if (fun = can_fix_p (GET_MODE (to), GET_MODE (from), unsignedp, &must_trunc))
  1115.     {
  1116.       if (must_trunc)
  1117.     from = ftruncify (from);
  1118.       emit_insn ((*fun) (to, from));
  1119.       return;
  1120.     }
  1121.  
  1122.   if (GET_MODE (to) != DImode
  1123.       && (fun = can_fix_p (DImode, GET_MODE (from), unsignedp, &must_trunc)))
  1124.     {
  1125.       register rtx temp = gen_reg_rtx (DImode);
  1126.       if (must_trunc)
  1127.     from = ftruncify (from);
  1128.       emit_insn ((*fun) (temp, from));
  1129.       convert_move (to, temp, unsignedp);
  1130.       return;
  1131.     }
  1132.  
  1133.   if (GET_MODE (from) != DFmode)
  1134.     {
  1135.       register rtx tem = gen_reg_rtx (DFmode);
  1136.       convert_move (tem, from, 0);
  1137.       from = tem;
  1138.     }
  1139.  
  1140.   if (fun = can_fix_p (GET_MODE (to), GET_MODE (from), unsignedp, &must_trunc))
  1141.     {
  1142.       if (must_trunc)
  1143.     from = ftruncify (from);
  1144.       emit_insn ((*fun) (to, from));
  1145.       return;
  1146.     }
  1147.  
  1148.   if (fun = can_fix_p (DImode, DFmode, unsignedp, &must_trunc))
  1149.     {
  1150.       if (must_trunc)
  1151.     from = ftruncify (from);
  1152.       target = gen_reg_rtx (DImode);
  1153.       emit_insn ((*fun) (target, from));
  1154.     }
  1155.   else if (GET_MODE (to) != DImode)
  1156.     {
  1157.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode,
  1158.                   unsignedp ? "_fixunsdfsi"
  1159.                   : "_fixdfsi"),
  1160.              SImode, 1, from, DFmode);
  1161.       target = hard_libcall_value (SImode);
  1162.     }
  1163.   else
  1164.     {
  1165.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode,
  1166.                   unsignedp ? "_fixunsdfdi"
  1167.                   : "_fixdfdi"),
  1168.              DImode, 1, from, DFmode);
  1169.       target = hard_libcall_value (DImode);
  1170.     }
  1171.  
  1172.   if (GET_MODE (to) == DImode)
  1173.     emit_move_insn (to, target);
  1174.   else
  1175.     convert_move (to, target, 0);
  1176. }
  1177.  
  1178. static optab
  1179. init_optab (code)
  1180.      enum rtx_code code;
  1181. {
  1182.   int i;
  1183.   optab op = (optab) malloc (sizeof (struct optab));
  1184.   op->code = code;
  1185.   for (i = 0; i < NUM_MACHINE_MODES; i++)
  1186.     {
  1187.       op->handlers[i].insn_code = CODE_FOR_nothing;
  1188.       op->handlers[i].lib_call = 0;
  1189.     }
  1190.   return op;
  1191. }
  1192.  
  1193. /* Call this once to initialize the contents of the optabs
  1194.    appropriately for the current target machine.  */
  1195.  
  1196. void
  1197. init_optabs ()
  1198. {
  1199.   init_fixtab ();
  1200.   init_floattab ();
  1201.   init_comparisons ();
  1202.   init_extends ();
  1203.  
  1204.   add_optab = init_optab (PLUS);
  1205.   sub_optab = init_optab (MINUS);
  1206.   smul_optab = init_optab (MULT);
  1207.   umul_optab = init_optab (UMULT);
  1208.   smul_widen_optab = init_optab (MULT);
  1209.   umul_widen_optab = init_optab (UMULT);
  1210.   sdiv_optab = init_optab (DIV);
  1211.   sdivmod_optab = init_optab (UNKNOWN);
  1212.   udiv_optab = init_optab (UDIV);
  1213.   udivmod_optab = init_optab (UNKNOWN);
  1214.   smod_optab = init_optab (MOD);
  1215.   umod_optab = init_optab (UMOD);
  1216.   flodiv_optab = init_optab (DIV);
  1217.   ftrunc_optab = init_optab (UNKNOWN);
  1218.   and_optab = init_optab (AND);
  1219.   andcb_optab = init_optab (UNKNOWN);
  1220.   ior_optab = init_optab (IOR);
  1221.   xor_optab = init_optab (XOR);
  1222.   ashl_optab = init_optab (ASHIFT);
  1223.   ashr_optab = init_optab (ASHIFTRT);
  1224.   lshl_optab = init_optab (LSHIFT);
  1225.   lshr_optab = init_optab (LSHIFTRT);
  1226.   rotl_optab = init_optab (ROTATE);
  1227.   rotr_optab = init_optab (ROTATERT);
  1228.   mov_optab = init_optab (UNKNOWN);
  1229.   movstrict_optab = init_optab (UNKNOWN);
  1230.   cmp_optab = init_optab (UNKNOWN);
  1231.   tst_optab = init_optab (UNKNOWN);
  1232.   neg_optab = init_optab (NEG);
  1233.   abs_optab = init_optab (ABS);
  1234.   one_cmpl_optab = init_optab (NOT);
  1235.   ffs_optab = init_optab (FFS);
  1236.  
  1237. #ifdef HAVE_addqi3
  1238.   if (HAVE_addqi3)
  1239.     add_optab->handlers[(int) QImode].insn_code = CODE_FOR_addqi3;
  1240. #endif
  1241. #ifdef HAVE_addhi3
  1242.   if (HAVE_addhi3)
  1243.     add_optab->handlers[(int) HImode].insn_code = CODE_FOR_addhi3;
  1244. #endif
  1245. #ifdef HAVE_addsi3
  1246.   if (HAVE_addsi3)
  1247.     add_optab->handlers[(int) SImode].insn_code = CODE_FOR_addsi3;
  1248. #endif
  1249. #ifdef HAVE_adddi3
  1250.   if (HAVE_adddi3)
  1251.     add_optab->handlers[(int) DImode].insn_code = CODE_FOR_adddi3;
  1252. #endif
  1253. #ifdef HAVE_addsf3
  1254.   if (HAVE_addsf3)
  1255.     add_optab->handlers[(int) SFmode].insn_code = CODE_FOR_addsf3;
  1256. #endif
  1257. #ifdef HAVE_adddf3
  1258.   if (HAVE_adddf3)
  1259.     add_optab->handlers[(int) DFmode].insn_code = CODE_FOR_adddf3;
  1260. #endif
  1261.   add_optab->handlers[(int) DImode].lib_call = "_adddi3";
  1262.   add_optab->handlers[(int) SFmode].lib_call = "_addsf3";
  1263.   add_optab->handlers[(int) DFmode].lib_call = "_adddf3";
  1264.  
  1265. #ifdef HAVE_subqi3
  1266.   if (HAVE_subqi3)
  1267.     sub_optab->handlers[(int) QImode].insn_code = CODE_FOR_subqi3;
  1268. #endif
  1269. #ifdef HAVE_subhi3
  1270.   if (HAVE_subhi3)
  1271.     sub_optab->handlers[(int) HImode].insn_code = CODE_FOR_subhi3;
  1272. #endif
  1273. #ifdef HAVE_subsi3
  1274.   if (HAVE_subsi3)
  1275.     sub_optab->handlers[(int) SImode].insn_code = CODE_FOR_subsi3;
  1276. #endif
  1277. #ifdef HAVE_subdi3
  1278.   if (HAVE_subdi3)
  1279.     sub_optab->handlers[(int) DImode].insn_code = CODE_FOR_subdi3;
  1280. #endif
  1281. #ifdef HAVE_subsf3
  1282.   if (HAVE_subsf3)
  1283.     sub_optab->handlers[(int) SFmode].insn_code = CODE_FOR_subsf3;
  1284. #endif
  1285. #ifdef HAVE_subdf3
  1286.   if (HAVE_subdf3)
  1287.     sub_optab->handlers[(int) DFmode].insn_code = CODE_FOR_subdf3;
  1288. #endif
  1289.   sub_optab->handlers[(int) DImode].lib_call = "_subdi3";
  1290.   sub_optab->handlers[(int) SFmode].lib_call = "_subsf3";
  1291.   sub_optab->handlers[(int) DFmode].lib_call = "_subdf3";
  1292.  
  1293. #ifdef HAVE_mulqi3
  1294.   if (HAVE_mulqi3)
  1295.     smul_optab->handlers[(int) QImode].insn_code = CODE_FOR_mulqi3;
  1296. #endif
  1297. #ifdef HAVE_mulhi3
  1298.   if (HAVE_mulhi3)
  1299.     smul_optab->handlers[(int) HImode].insn_code = CODE_FOR_mulhi3;
  1300. #endif
  1301. #ifdef HAVE_mulsi3
  1302.   if (HAVE_mulsi3)
  1303.     smul_optab->handlers[(int) SImode].insn_code = CODE_FOR_mulsi3;
  1304. #endif
  1305. #ifdef HAVE_muldi3
  1306.   if (HAVE_muldi3)
  1307.     smul_optab->handlers[(int) DImode].insn_code = CODE_FOR_muldi3;
  1308. #endif
  1309. #ifdef HAVE_mulsf3
  1310.   if (HAVE_mulsf3)
  1311.     smul_optab->handlers[(int) SFmode].insn_code = CODE_FOR_mulsf3;
  1312. #endif
  1313. #ifdef HAVE_muldf3
  1314.   if (HAVE_muldf3)
  1315.     smul_optab->handlers[(int) DFmode].insn_code = CODE_FOR_muldf3;
  1316. #endif
  1317.   smul_optab->handlers[(int) SImode].lib_call = "_mulsi3";
  1318.   smul_optab->handlers[(int) DImode].lib_call = "_muldi3";
  1319.   smul_optab->handlers[(int) SFmode].lib_call = "_mulsf3";
  1320.   smul_optab->handlers[(int) DFmode].lib_call = "_muldf3";
  1321.  
  1322. #ifdef HAVE_mulqihi3
  1323.   if (HAVE_mulqihi3)
  1324.     smul_widen_optab->handlers[(int) HImode].insn_code = CODE_FOR_mulqihi3;
  1325. #endif
  1326. #ifdef HAVE_mulhisi3
  1327.   if (HAVE_mulhisi3)
  1328.     smul_widen_optab->handlers[(int) SImode].insn_code = CODE_FOR_mulhisi3;
  1329. #endif
  1330. #ifdef HAVE_mulsidi3
  1331.   if (HAVE_mulsidi3)
  1332.     smul_widen_optab->handlers[(int) DImode].insn_code = CODE_FOR_mulsidi3;
  1333. #endif
  1334.  
  1335. #ifdef HAVE_umulqi3
  1336.   if (HAVE_umulqi3)
  1337.     umul_optab->handlers[(int) QImode].insn_code = CODE_FOR_umulqi3;
  1338. #endif
  1339. #ifdef HAVE_umulhi3
  1340.   if (HAVE_umulhi3)
  1341.     umul_optab->handlers[(int) HImode].insn_code = CODE_FOR_umulhi3;
  1342. #endif
  1343. #ifdef HAVE_umulsi3
  1344.   if (HAVE_umulsi3)
  1345.     umul_optab->handlers[(int) SImode].insn_code = CODE_FOR_umulsi3;
  1346. #endif
  1347. #ifdef HAVE_umuldi3
  1348.   if (HAVE_umuldi3)
  1349.     umul_optab->handlers[(int) DImode].insn_code = CODE_FOR_umuldi3;
  1350. #endif
  1351. #ifdef HAVE_umulsf3
  1352.   if (HAVE_umulsf3)
  1353.     umul_optab->handlers[(int) SFmode].insn_code = CODE_FOR_umulsf3;
  1354. #endif
  1355. #ifdef HAVE_umuldf3
  1356.   if (HAVE_umuldf3)
  1357.     umul_optab->handlers[(int) DFmode].insn_code = CODE_FOR_umuldf3;
  1358. #endif
  1359.   umul_optab->handlers[(int) SImode].lib_call = "_umulsi3";
  1360.   umul_optab->handlers[(int) DImode].lib_call = "_umuldi3";
  1361.   umul_optab->handlers[(int) SFmode].lib_call = "_umulsf3";
  1362.   umul_optab->handlers[(int) DFmode].lib_call = "_umuldf3";
  1363.  
  1364. #ifdef HAVE_umulqihi3
  1365.   if (HAVE_umulqihi3)
  1366.     umul_widen_optab->handlers[(int) HImode].insn_code = CODE_FOR_umulqihi3;
  1367. #endif
  1368. #ifdef HAVE_umulhisi3
  1369.   if (HAVE_umulhisi3)
  1370.     umul_widen_optab->handlers[(int) SImode].insn_code = CODE_FOR_umulhisi3;
  1371. #endif
  1372. #ifdef HAVE_umulsidi3
  1373.   if (HAVE_umulsidi3)
  1374.     umul_widen_optab->handlers[(int) DImode].insn_code = CODE_FOR_umulsidi3;
  1375. #endif
  1376.  
  1377. #ifdef HAVE_divqi3
  1378.   if (HAVE_divqi3)
  1379.     sdiv_optab->handlers[(int) QImode].insn_code = CODE_FOR_divqi3;
  1380. #endif
  1381. #ifdef HAVE_divhi3
  1382.   if (HAVE_divhi3)
  1383.     sdiv_optab->handlers[(int) HImode].insn_code = CODE_FOR_divhi3;
  1384. #endif
  1385. #ifdef HAVE_divsi3
  1386.   if (HAVE_divsi3)
  1387.     sdiv_optab->handlers[(int) SImode].insn_code = CODE_FOR_divsi3;
  1388. #endif
  1389. #ifdef HAVE_divdi3
  1390.   if (HAVE_divdi3)
  1391.     sdiv_optab->handlers[(int) DImode].insn_code = CODE_FOR_divdi3;
  1392. #endif
  1393.   sdiv_optab->handlers[(int) SImode].lib_call = "_divsi3";
  1394.   sdiv_optab->handlers[(int) DImode].lib_call = "_divdi3";
  1395.  
  1396. #ifdef HAVE_udivqi3
  1397.   if (HAVE_udivqi3)
  1398.     udiv_optab->handlers[(int) QImode].insn_code = CODE_FOR_udivqi3;
  1399. #endif
  1400. #ifdef HAVE_udivhi3
  1401.   if (HAVE_udivhi3)
  1402.     udiv_optab->handlers[(int) HImode].insn_code = CODE_FOR_udivhi3;
  1403. #endif
  1404. #ifdef HAVE_udivsi3
  1405.   if (HAVE_udivsi3)
  1406.     udiv_optab->handlers[(int) SImode].insn_code = CODE_FOR_udivsi3;
  1407. #endif
  1408. #ifdef HAVE_udivdi3
  1409.   if (HAVE_udivdi3)
  1410.     udiv_optab->handlers[(int) DImode].insn_code = CODE_FOR_udivdi3;
  1411. #endif
  1412. #ifdef UDIVSI3_LIBCALL
  1413.   udiv_optab->handlers[(int) SImode].lib_call = UDIVSI3_LIBCALL;
  1414. #else
  1415.   udiv_optab->handlers[(int) SImode].lib_call = "_udivsi3";
  1416. #endif
  1417.   udiv_optab->handlers[(int) DImode].lib_call = "_udivdi3";
  1418.  
  1419. #ifdef HAVE_divmodqi4
  1420.   if (HAVE_divmodqi4)
  1421.     sdivmod_optab->handlers[(int) QImode].insn_code = CODE_FOR_divmodqi4;
  1422. #endif
  1423. #ifdef HAVE_divmodhi4
  1424.   if (HAVE_divmodhi4)
  1425.     sdivmod_optab->handlers[(int) HImode].insn_code = CODE_FOR_divmodhi4;
  1426. #endif
  1427. #ifdef HAVE_divmodsi4
  1428.   if (HAVE_divmodsi4)
  1429.     sdivmod_optab->handlers[(int) SImode].insn_code = CODE_FOR_divmodsi4;
  1430. #endif
  1431. #ifdef HAVE_divmoddi4
  1432.   if (HAVE_divmoddi4)
  1433.     sdivmod_optab->handlers[(int) DImode].insn_code = CODE_FOR_divmoddi4;
  1434. #endif
  1435.  
  1436. #ifdef HAVE_udivmodqi4
  1437.   if (HAVE_udivmodqi4)
  1438.     udivmod_optab->handlers[(int) QImode].insn_code = CODE_FOR_udivmodqi4;
  1439. #endif
  1440. #ifdef HAVE_udivmodhi4
  1441.   if (HAVE_udivmodhi4)
  1442.     udivmod_optab->handlers[(int) HImode].insn_code = CODE_FOR_udivmodhi4;
  1443. #endif
  1444. #ifdef HAVE_udivmodsi4
  1445.   if (HAVE_udivmodsi4)
  1446.     udivmod_optab->handlers[(int) SImode].insn_code = CODE_FOR_udivmodsi4;
  1447. #endif
  1448. #ifdef HAVE_udivmoddi4
  1449.   if (HAVE_udivmoddi4)
  1450.     udivmod_optab->handlers[(int) DImode].insn_code = CODE_FOR_udivmoddi4;
  1451. #endif
  1452.  
  1453. #ifdef HAVE_modqi3
  1454.   if (HAVE_modqi3)
  1455.     smod_optab->handlers[(int) QImode].insn_code = CODE_FOR_modqi3;
  1456. #endif
  1457. #ifdef HAVE_modhi3
  1458.   if (HAVE_modhi3)
  1459.     smod_optab->handlers[(int) HImode].insn_code = CODE_FOR_modhi3;
  1460. #endif
  1461. #ifdef HAVE_modsi3
  1462.   if (HAVE_modsi3)
  1463.     smod_optab->handlers[(int) SImode].insn_code = CODE_FOR_modsi3;
  1464. #endif
  1465. #ifdef HAVE_moddi3
  1466.   if (HAVE_moddi3)
  1467.     smod_optab->handlers[(int) DImode].insn_code = CODE_FOR_moddi3;
  1468. #endif
  1469.   smod_optab->handlers[(int) SImode].lib_call = "_modsi3";
  1470.   smod_optab->handlers[(int) DImode].lib_call = "_moddi3";
  1471.  
  1472. #ifdef HAVE_umodqi3
  1473.   if (HAVE_umodqi3)
  1474.     umod_optab->handlers[(int) QImode].insn_code = CODE_FOR_umodqi3;
  1475. #endif
  1476. #ifdef HAVE_umodhi3
  1477.   if (HAVE_umodhi3)
  1478.     umod_optab->handlers[(int) HImode].insn_code = CODE_FOR_umodhi3;
  1479. #endif
  1480. #ifdef HAVE_umodsi3
  1481.   if (HAVE_umodsi3)
  1482.     umod_optab->handlers[(int) SImode].insn_code = CODE_FOR_umodsi3;
  1483. #endif
  1484. #ifdef HAVE_umoddi3
  1485.   if (HAVE_umoddi3)
  1486.     umod_optab->handlers[(int) DImode].insn_code = CODE_FOR_umoddi3;
  1487. #endif
  1488. #ifdef UMODSI3_LIBCALL
  1489.   umod_optab->handlers[(int) SImode].lib_call = UMODSI3_LIBCALL;
  1490. #else
  1491.   umod_optab->handlers[(int) SImode].lib_call = "_umodsi3";
  1492. #endif
  1493.   umod_optab->handlers[(int) DImode].lib_call = "_umoddi3";
  1494.  
  1495. #ifdef HAVE_divsf3
  1496.   if (HAVE_divsf3)
  1497.     flodiv_optab->handlers[(int) SFmode].insn_code = CODE_FOR_divsf3;
  1498. #endif
  1499. #ifdef HAVE_divdf3
  1500.   if (HAVE_divdf3)
  1501.     flodiv_optab->handlers[(int) DFmode].insn_code = CODE_FOR_divdf3;
  1502. #endif
  1503.   flodiv_optab->handlers[(int) SFmode].lib_call = "_divsf3";
  1504.   flodiv_optab->handlers[(int) DFmode].lib_call = "_divdf3";
  1505.  
  1506. #ifdef HAVE_ftruncsf2
  1507.   if (HAVE_ftruncsf2)
  1508.     ftrunc_optab->handlers[(int) SFmode].insn_code = CODE_FOR_ftruncsf2;
  1509. #endif
  1510. #ifdef HAVE_ftruncdf2
  1511.   if (HAVE_ftruncdf2)
  1512.     ftrunc_optab->handlers[(int) DFmode].insn_code = CODE_FOR_ftruncdf2;
  1513. #endif
  1514.   ftrunc_optab->handlers[(int) SFmode].lib_call = "_ftruncsf2";
  1515.   ftrunc_optab->handlers[(int) DFmode].lib_call = "_ftruncsf2";
  1516.  
  1517. #ifdef HAVE_andqi3
  1518.   if (HAVE_andqi3)
  1519.     and_optab->handlers[(int) QImode].insn_code = CODE_FOR_andqi3;
  1520. #endif
  1521. #ifdef HAVE_andhi3
  1522.   if (HAVE_andhi3)
  1523.     and_optab->handlers[(int) HImode].insn_code = CODE_FOR_andhi3;
  1524. #endif
  1525. #ifdef HAVE_andsi3
  1526.   if (HAVE_andsi3)
  1527.     and_optab->handlers[(int) SImode].insn_code = CODE_FOR_andsi3;
  1528. #endif
  1529.   and_optab->handlers[(int) DImode].lib_call = "_anddi3";
  1530.  
  1531. #ifdef HAVE_andcbqi3
  1532.   if (HAVE_andcbqi3)
  1533.     andcb_optab->handlers[(int) QImode].insn_code = CODE_FOR_andcbqi3;
  1534. #endif
  1535. #ifdef HAVE_andcbhi3
  1536.   if (HAVE_andcbhi3)
  1537.     andcb_optab->handlers[(int) HImode].insn_code = CODE_FOR_andcbhi3;
  1538. #endif
  1539. #ifdef HAVE_andcbsi3
  1540.   if (HAVE_andcbsi3)
  1541.     andcb_optab->handlers[(int) SImode].insn_code = CODE_FOR_andcbsi3;
  1542. #endif
  1543.   andcb_optab->handlers[(int) DImode].lib_call = "_andcbdi3";
  1544.  
  1545. #ifdef HAVE_iorqi3
  1546.   if (HAVE_iorqi3)
  1547.     ior_optab->handlers[(int) QImode].insn_code = CODE_FOR_iorqi3;
  1548. #endif
  1549. #ifdef HAVE_iorhi3
  1550.   if (HAVE_iorhi3)
  1551.     ior_optab->handlers[(int) HImode].insn_code = CODE_FOR_iorhi3;
  1552. #endif
  1553. #ifdef HAVE_iorsi3
  1554.   if (HAVE_iorsi3)
  1555.     ior_optab->handlers[(int) SImode].insn_code = CODE_FOR_iorsi3;
  1556. #endif
  1557.   ior_optab->handlers[(int) DImode].lib_call = "_iordi3";
  1558.  
  1559. #ifdef HAVE_xorqi3
  1560.   if (HAVE_xorqi3)
  1561.     xor_optab->handlers[(int) QImode].insn_code = CODE_FOR_xorqi3;
  1562. #endif
  1563. #ifdef HAVE_xorhi3
  1564.   if (HAVE_xorhi3)
  1565.     xor_optab->handlers[(int) HImode].insn_code = CODE_FOR_xorhi3;
  1566. #endif
  1567. #ifdef HAVE_xorsi3
  1568.   if (HAVE_xorsi3)
  1569.     xor_optab->handlers[(int) SImode].insn_code = CODE_FOR_xorsi3;
  1570. #endif
  1571.   xor_optab->handlers[(int) DImode].lib_call = "_xordi3";
  1572.  
  1573. #ifdef HAVE_ashlqi3
  1574.   if (HAVE_ashlqi3)
  1575.     ashl_optab->handlers[(int) QImode].insn_code = CODE_FOR_ashlqi3;
  1576. #endif
  1577. #ifdef HAVE_ashlhi3
  1578.   if (HAVE_ashlhi3)
  1579.     ashl_optab->handlers[(int) HImode].insn_code = CODE_FOR_ashlhi3;
  1580. #endif
  1581. #ifdef HAVE_ashlsi3
  1582.   if (HAVE_ashlsi3)
  1583.     ashl_optab->handlers[(int) SImode].insn_code = CODE_FOR_ashlsi3;
  1584. #endif
  1585. #ifdef HAVE_ashldi3
  1586.   if (HAVE_ashldi3)
  1587.     ashl_optab->handlers[(int) DImode].insn_code = CODE_FOR_ashldi3;
  1588. #endif
  1589.   ashl_optab->handlers[(int) SImode].lib_call = "_ashlsi3";
  1590.   ashl_optab->handlers[(int) DImode].lib_call = "_ashldi3";
  1591.  
  1592. #ifdef HAVE_ashrqi3
  1593.   if (HAVE_ashrqi3)
  1594.     ashr_optab->handlers[(int) QImode].insn_code = CODE_FOR_ashrqi3;
  1595. #endif
  1596. #ifdef HAVE_ashrhi3
  1597.   if (HAVE_ashrhi3)
  1598.     ashr_optab->handlers[(int) HImode].insn_code = CODE_FOR_ashrhi3;
  1599. #endif
  1600. #ifdef HAVE_ashrsi3
  1601.   if (HAVE_ashrsi3)
  1602.     ashr_optab->handlers[(int) SImode].insn_code = CODE_FOR_ashrsi3;
  1603. #endif
  1604. #ifdef HAVE_ashrdi3
  1605.   if (HAVE_ashrdi3)
  1606.     ashr_optab->handlers[(int) DImode].insn_code = CODE_FOR_ashrdi3;
  1607. #endif
  1608.   ashr_optab->handlers[(int) SImode].lib_call = "_ashrsi3";
  1609.   ashr_optab->handlers[(int) DImode].lib_call = "_ashrdi3";
  1610.  
  1611. #ifdef HAVE_lshlqi3
  1612.   if (HAVE_lshlqi3)
  1613.     lshl_optab->handlers[(int) QImode].insn_code = CODE_FOR_lshlqi3;
  1614. #endif
  1615. #ifdef HAVE_lshlhi3
  1616.   if (HAVE_lshlhi3)
  1617.     lshl_optab->handlers[(int) HImode].insn_code = CODE_FOR_lshlhi3;
  1618. #endif
  1619. #ifdef HAVE_lshlsi3
  1620.   if (HAVE_lshlsi3)
  1621.     lshl_optab->handlers[(int) SImode].insn_code = CODE_FOR_lshlsi3;
  1622. #endif
  1623. #ifdef HAVE_lshldi3
  1624.   if (HAVE_lshldi3)
  1625.     lshl_optab->handlers[(int) DImode].insn_code = CODE_FOR_lshldi3;
  1626. #endif
  1627.   lshl_optab->handlers[(int) SImode].lib_call = "_lshlsi3";
  1628.   lshl_optab->handlers[(int) DImode].lib_call = "_lshldi3";
  1629.  
  1630. #ifdef HAVE_lshrqi3
  1631.   if (HAVE_lshrqi3)
  1632.     lshr_optab->handlers[(int) QImode].insn_code = CODE_FOR_lshrqi3;
  1633. #endif
  1634. #ifdef HAVE_lshrhi3
  1635.   if (HAVE_lshrhi3)
  1636.     lshr_optab->handlers[(int) HImode].insn_code = CODE_FOR_lshrhi3;
  1637. #endif
  1638. #ifdef HAVE_lshrsi3
  1639.   if (HAVE_lshrsi3)
  1640.     lshr_optab->handlers[(int) SImode].insn_code = CODE_FOR_lshrsi3;
  1641. #endif
  1642. #ifdef HAVE_lshrdi3
  1643.   if (HAVE_lshrdi3)
  1644.     lshr_optab->handlers[(int) DImode].insn_code = CODE_FOR_lshrdi3;
  1645. #endif
  1646.   lshr_optab->handlers[(int) SImode].lib_call = "_lshrsi3";
  1647.   lshr_optab->handlers[(int) DImode].lib_call = "_lshrdi3";
  1648.  
  1649. #ifdef HAVE_rotlqi3
  1650.   if (HAVE_rotlqi3)
  1651.     rotl_optab->handlers[(int) QImode].insn_code = CODE_FOR_rotlqi3;
  1652. #endif
  1653. #ifdef HAVE_rotlhi3
  1654.   if (HAVE_rotlhi3)
  1655.     rotl_optab->handlers[(int) HImode].insn_code = CODE_FOR_rotlhi3;
  1656. #endif
  1657. #ifdef HAVE_rotlsi3
  1658.   if (HAVE_rotlsi3)
  1659.     rotl_optab->handlers[(int) SImode].insn_code = CODE_FOR_rotlsi3;
  1660. #endif
  1661. #ifdef HAVE_rotldi3
  1662.   if (HAVE_rotldi3)
  1663.     rotl_optab->handlers[(int) DImode].insn_code = CODE_FOR_rotldi3;
  1664. #endif
  1665.   rotl_optab->handlers[(int) SImode].lib_call = "_rotlsi3";
  1666.   rotl_optab->handlers[(int) DImode].lib_call = "_rotldi3";
  1667.  
  1668. #ifdef HAVE_rotrqi3
  1669.   if (HAVE_rotrqi3)
  1670.     rotr_optab->handlers[(int) QImode].insn_code = CODE_FOR_rotrqi3;
  1671. #endif
  1672. #ifdef HAVE_rotrhi3
  1673.   if (HAVE_rotrhi3)
  1674.     rotr_optab->handlers[(int) HImode].insn_code = CODE_FOR_rotrhi3;
  1675. #endif
  1676. #ifdef HAVE_rotrsi3
  1677.   if (HAVE_rotrsi3)
  1678.     rotr_optab->handlers[(int) SImode].insn_code = CODE_FOR_rotrsi3;
  1679. #endif
  1680. #ifdef HAVE_rotrdi3
  1681.   if (HAVE_rotrdi3)
  1682.     rotr_optab->handlers[(int) DImode].insn_code = CODE_FOR_rotrdi3;
  1683. #endif
  1684.   rotr_optab->handlers[(int) SImode].lib_call = "_rotrsi3";
  1685.   rotr_optab->handlers[(int) DImode].lib_call = "_rotrdi3";
  1686.  
  1687. #ifdef HAVE_negqi2
  1688.   if (HAVE_negqi2)
  1689.     neg_optab->handlers[(int) QImode].insn_code = CODE_FOR_negqi2;
  1690. #endif
  1691. #ifdef HAVE_neghi2
  1692.   if (HAVE_neghi2)
  1693.     neg_optab->handlers[(int) HImode].insn_code = CODE_FOR_neghi2;
  1694. #endif
  1695. #ifdef HAVE_negsi2
  1696.   if (HAVE_negsi2)
  1697.     neg_optab->handlers[(int) SImode].insn_code = CODE_FOR_negsi2;
  1698. #endif
  1699. #ifdef HAVE_negsf2
  1700.   if (HAVE_negsf2)
  1701.     neg_optab->handlers[(int) SFmode].insn_code = CODE_FOR_negsf2;
  1702. #endif
  1703. #ifdef HAVE_negdf2
  1704.   if (HAVE_negdf2)
  1705.     neg_optab->handlers[(int) DFmode].insn_code = CODE_FOR_negdf2;
  1706. #endif
  1707.   neg_optab->handlers[(int) SImode].lib_call = "_negsi2"; 
  1708.   neg_optab->handlers[(int) DImode].lib_call = "_negdi2";
  1709.   neg_optab->handlers[(int) SFmode].lib_call = "_negsf2";
  1710.   neg_optab->handlers[(int) DFmode].lib_call = "_negdf2";
  1711.  
  1712. #ifdef HAVE_absqi2
  1713.   if (HAVE_absqi2)
  1714.     abs_optab->handlers[(int) QImode].insn_code = CODE_FOR_absqi2;
  1715. #endif
  1716. #ifdef HAVE_abshi2
  1717.   if (HAVE_abshi2)
  1718.     abs_optab->handlers[(int) HImode].insn_code = CODE_FOR_abshi2;
  1719. #endif
  1720. #ifdef HAVE_abssi2
  1721.   if (HAVE_abssi2)
  1722.     abs_optab->handlers[(int) SImode].insn_code = CODE_FOR_abssi2;
  1723. #endif
  1724. #ifdef HAVE_abssf2
  1725.   if (HAVE_abssf2)
  1726.     abs_optab->handlers[(int) SFmode].insn_code = CODE_FOR_abssf2;
  1727. #endif
  1728. #ifdef HAVE_absdf2
  1729.   if (HAVE_absdf2)
  1730.     abs_optab->handlers[(int) DFmode].insn_code = CODE_FOR_absdf2;
  1731. #endif
  1732.   /* No library calls here!  If there is no abs instruction,
  1733.      expand_expr will generate a conditional negation.  */
  1734.  
  1735. #ifdef HAVE_one_cmplqi2
  1736.   if (HAVE_one_cmplqi2)
  1737.     one_cmpl_optab->handlers[(int) QImode].insn_code = CODE_FOR_one_cmplqi2;
  1738. #endif
  1739. #ifdef HAVE_one_cmplhi2
  1740.   if (HAVE_one_cmplhi2)
  1741.     one_cmpl_optab->handlers[(int) HImode].insn_code = CODE_FOR_one_cmplhi2;
  1742. #endif
  1743. #ifdef HAVE_one_cmplsi2
  1744.   if (HAVE_one_cmplsi2)
  1745.     one_cmpl_optab->handlers[(int) SImode].insn_code = CODE_FOR_one_cmplsi2;
  1746. #endif
  1747.   one_cmpl_optab->handlers[(int) SImode].lib_call = "_one_cmplsi2"; 
  1748.   one_cmpl_optab->handlers[(int) DImode].lib_call = "_one_cmpldi2";
  1749.  
  1750. #ifdef HAVE_ffsqi2
  1751.   if (HAVE_ffsqi2)
  1752.     ffs_optab->handlers[(int) QImode].insn_code = CODE_FOR_ffsqi2;
  1753. #endif
  1754. #ifdef HAVE_ffshi2
  1755.   if (HAVE_ffshi2)
  1756.     ffs_optab->handlers[(int) HImode].insn_code = CODE_FOR_ffshi2;
  1757. #endif
  1758. #ifdef HAVE_ffssi2
  1759.   if (HAVE_ffssi2)
  1760.     ffs_optab->handlers[(int) SImode].insn_code = CODE_FOR_ffssi2;
  1761. #endif
  1762.   ffs_optab->handlers[(int) SImode].lib_call = "ffs"; 
  1763.  
  1764. #ifdef HAVE_movqi
  1765.   if (HAVE_movqi)
  1766.     mov_optab->handlers[(int) QImode].insn_code = CODE_FOR_movqi;
  1767. #endif
  1768. #ifdef HAVE_movhi
  1769.   if (HAVE_movhi)
  1770.     mov_optab->handlers[(int) HImode].insn_code = CODE_FOR_movhi;
  1771. #endif
  1772. #ifdef HAVE_movsi
  1773.   if (HAVE_movsi)
  1774.     mov_optab->handlers[(int) SImode].insn_code = CODE_FOR_movsi;
  1775. #endif
  1776. #ifdef HAVE_movdi
  1777.   if (HAVE_movdi)
  1778.     mov_optab->handlers[(int) DImode].insn_code = CODE_FOR_movdi;
  1779. #endif
  1780. #ifdef HAVE_movsf
  1781.   if (HAVE_movsf)
  1782.     mov_optab->handlers[(int) SFmode].insn_code = CODE_FOR_movsf;
  1783. #endif
  1784. #ifdef HAVE_movdf
  1785.   if (HAVE_movdf)
  1786.     mov_optab->handlers[(int) DFmode].insn_code = CODE_FOR_movdf;
  1787. #endif
  1788.  
  1789. #ifdef HAVE_movstrictqi
  1790.   if (HAVE_movstrictqi)
  1791.     movstrict_optab->handlers[(int) QImode].insn_code = CODE_FOR_movstrictqi;
  1792. #endif
  1793. #ifdef HAVE_movstricthi
  1794.   if (HAVE_movstricthi)
  1795.     movstrict_optab->handlers[(int) HImode].insn_code = CODE_FOR_movstricthi;
  1796. #endif
  1797. #ifdef HAVE_movstrictsi
  1798.   if (HAVE_movstrictsi)
  1799.     movstrict_optab->handlers[(int) SImode].insn_code = CODE_FOR_movstrictsi;
  1800. #endif
  1801. #ifdef HAVE_movstrictdi
  1802.   if (HAVE_movstrictdi)
  1803.     movstrict_optab->handlers[(int) DImode].insn_code = CODE_FOR_movstrictdi;
  1804. #endif
  1805.  
  1806. #ifdef HAVE_cmpqi
  1807.   if (HAVE_cmpqi)
  1808.     cmp_optab->handlers[(int) QImode].insn_code = CODE_FOR_cmpqi;
  1809. #endif
  1810. #ifdef HAVE_cmphi
  1811.   if (HAVE_cmphi)
  1812.     cmp_optab->handlers[(int) HImode].insn_code = CODE_FOR_cmphi;
  1813. #endif
  1814. #ifdef HAVE_cmpsi
  1815.   if (HAVE_cmpsi)
  1816.     cmp_optab->handlers[(int) SImode].insn_code = CODE_FOR_cmpsi;
  1817. #endif
  1818. #ifdef HAVE_cmpsf
  1819.   if (HAVE_cmpsf)
  1820.     cmp_optab->handlers[(int) SFmode].insn_code = CODE_FOR_cmpsf;
  1821. #endif
  1822. #ifdef HAVE_cmpdf
  1823.   if (HAVE_cmpdf)
  1824.     cmp_optab->handlers[(int) DFmode].insn_code = CODE_FOR_cmpdf;
  1825. #endif
  1826. #ifdef HAVE_tstqi
  1827.   if (HAVE_tstqi)
  1828.     tst_optab->handlers[(int) QImode].insn_code = CODE_FOR_tstqi;
  1829. #endif
  1830. #ifdef HAVE_tsthi
  1831.   if (HAVE_tsthi)
  1832.     tst_optab->handlers[(int) HImode].insn_code = CODE_FOR_tsthi;
  1833. #endif
  1834. #ifdef HAVE_tstsi
  1835.   if (HAVE_tstsi)
  1836.     tst_optab->handlers[(int) SImode].insn_code = CODE_FOR_tstsi;
  1837. #endif
  1838. #ifdef HAVE_tstsf
  1839.   if (HAVE_tstsf)
  1840.     tst_optab->handlers[(int) SFmode].insn_code = CODE_FOR_tstsf;
  1841. #endif
  1842. #ifdef HAVE_tstdf
  1843.   if (HAVE_tstdf)
  1844.     tst_optab->handlers[(int) DFmode].insn_code = CODE_FOR_tstdf;
  1845. #endif
  1846.   cmp_optab->handlers[(int) SImode].lib_call = "_cmpsi2"; 
  1847.   cmp_optab->handlers[(int) DImode].lib_call = "_cmpdi2";
  1848.   cmp_optab->handlers[(int) SFmode].lib_call = "_cmpsf2";
  1849.   cmp_optab->handlers[(int) DFmode].lib_call = "_cmpdf2";
  1850. }
  1851.